<?php

declare(strict_types=1);

namespace App\Services;

use App\Entities\ConvertibleCardEntity;
use App\Entities\ConvertibleCardModel;

// use App\Entity\HomepageRecommendEntity;
// use App\Models\HomepageCombo;
// use App\Models\HomepageRecommend;

class ConvertibleCardService
{
    public static function getConvertibleCardCount()
    {
        return ConvertibleCardModel::count();
    }

    public static function getConvertibleCardFirstId()
    {
        $firstCard = ConvertibleCardModel::first();
        return $firstCard->id;
    }

    public static function getEntityList()
    {
        $entityList = [];
        $data = ConvertibleCardModel::orderby('created_at', 'DESC')->get();
        if ($data) {
            foreach ($data as $cardModel) {
                $entityList[] = new ConvertibleCardEntity($cardModel);
            }
        }
        return $entityList;
    }
}
